home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 41.9 KB | 1,233 lines | [TEXT/MPS ] |
- ;
- ; File: BlockStoragePlugin.a
- ;
- ; Contains: Block Storage Plug In Programming Interface
- ;
- ; Version: Technology: Copland
- ; Release: Universal Interfaces 3.0d3 on Copland DR1
- ;
- ; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
- IF &TYPE('__BLOCKSTORAGEPLUGIN__') = 'UNDEFINED' THEN
- __BLOCKSTORAGEPLUGIN__ SET 1
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- IF &TYPE('__ERRORS__') = 'UNDEFINED' THEN
- include 'Errors.a'
- ENDIF
- IF &TYPE('__FILEMANAGERTYPES__') = 'UNDEFINED' THEN
- include 'FileManagerTypes.a'
- ENDIF
- IF &TYPE('__NAMEREGISTRY__') = 'UNDEFINED' THEN
- include 'NameRegistry.a'
- ENDIF
- IF &TYPE('__BLOCKSTORAGE__') = 'UNDEFINED' THEN
- include 'BlockStorage.a'
- ENDIF
- IF &TYPE('__IOMEMORYLISTS__') = 'UNDEFINED' THEN
- include 'IOMemoryLists.a'
- ENDIF
- IF FOR_SYSTEM8_PREEMPTIVE THEN
- ;
- ;******************************************************************************
- ; *******************************************************************************
- ; *******************************************************************************
- ;
- ; Plug In Constants
- ;
- ; *******************************************************************************
- ; *******************************************************************************
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; Options to a BSIOFunc
- ;
- ; *****************************************************************************
- ;
-
- kBSRead EQU 0
- kBSWrite EQU 1
- ;
- ;******************************************************************************
- ;
- ; Mapping Plug-In Level of Confidence values
- ;
- ; *****************************************************************************
- ;
-
- kBSMPIDeviceNotSupported EQU 0
- kBSMPIDeviceTypeRecognized EQU 1
- kBSMPIDeviceMfrRecognized EQU 2
- kBSMPIDeviceModelRecognized EQU 3
- kBSMPIDeviceMediaRecognized EQU 4
- ; typedef UInt32 BSMPIConfidenceLevel
-
- ;
- ;******************************************************************************
- ;
- ; Mapping Plug-In Level of Confidence values
- ;
- ; *****************************************************************************
- ;
-
- kBSCPIDeviceNotSupported EQU 0
- kBSCPIDeviceTypeRecognized EQU 1
- kBSCPIDeviceMfrRecognized EQU 2
- kBSCPIDeviceModelRecognized EQU 3
- ; typedef UInt32 BSCPIConfidenceLevel
-
- ;
- ;******************************************************************************
- ;
- ; Plug In Version - this tracks the revision of the plug-in interface and
- ; should be placed in the version field of the plug-in interface structure
- ;
- ; *****************************************************************************
- ;
-
- kBSPlugInInterfaceVersion EQU $02011996
- ;
- ;******************************************************************************
- ;
- ; BSIOStatus values
- ;
- ; *****************************************************************************
- ;
-
- kBSIOCompleted EQU 1
- kBSIOContinuing EQU 2
- kBSIOFailed EQU 3
- kBSIONotStarted EQU 4
- ; typedef UInt32 BSIOStatus
-
- ;
- ;******************************************************************************
- ; *******************************************************************************
- ; *******************************************************************************
- ;
- ; Types
- ;
- ; *******************************************************************************
- ; *******************************************************************************
- ; *****************************************************************************
- ;
- ; typedef void * BSStorePtr
-
- ; typedef void * BSContainerPtr
-
- ; typedef void * BSIORequestBlockPtr
-
- ; typedef OSStatus BSIOErrors
-
- ;
- ;******************************************************************************
- ; BSErrorList: another structure to manage I/O success/failure.
- ;
- ; BSErrorList data structure allows a Mapping Plug-In to keep track of the
- ; current state of each transfer request sent to it by the Block Storage client. If transfers complete
- ; successfully, a pointer 0 is returned. If an error occurs, a linked list (?) of these data structures
- ; is returned specifying the exact state of each transfer request.
- ;
- ; startingBlock: The initial transfer block of this fragment of the request
- ; blockCount: The number of blocks to be transfered including the startingBlock
- ; status: A constant representing the final state of the transfer of the blocks:
- ; kIONotStarted: No processing was begun on these blocks
- ; kIOStarted: The BS Plug-In began to process the blocks
- ; kIOToFamily: The request was sent to the device family
- ; kIOComplete: The request completed normally
- ; kIOFailed: The request failed to complete execution
- ; error: The exact error, if any
- ; xferID: An index representing which request of a multiple-request I/O this is
- ; next: A pointer to the next data structure (could be eliminated in favor of indices)
- ; *****************************************************************************
- ;
- BSErrorList RECORD 0
- startingBlock ds BSByteCount ; offset: $0 (0)
- length ds BSByteCount ; offset: $8 (8)
- status ds.l 1 ; offset: $10 (16)
- error ds.l 1 ; offset: $14 (20)
- xferID ds.l 1 ; offset: $18 (24)
- next ds.l 1 ; offset: $1C (28)
- sizeof EQU * ; size: $20 (32)
- ENDR
- ; typedef struct BSErrorList * BSErrorListPtr
-
- ;
- ;****************************************************************************
- ;
- ; BSStoreMPIComponent describes a component of a Store. A component may
- ; be an external device or another Store. This is the internal form of
- ; BSStoreComponent.
- ;
- ; ***************************************************************************
- ;
- BSStoreMPIComponent RECORD 0
- componentType ds.l 1 ; offset: $0 (0)
- startingOffset ds BSByteCount ; offset: $4 (4) ; Where in the Store this
- ; component will be placed
- sourceNode ds RegEntryRef ; offset: $C (12) ; Physical components
- srcStore ds.l 1 ; offset: $1C (28) ; Logical components
- partitionInfo ds BSPartitionDescriptor ; offset: $20 (32) ; Logical components
- ORG 358
- sizeof EQU * ; size: $166 (358)
- ENDR
- ; typedef struct BSStoreMPIComponent * BSStoreMPIComponentPtr
-
- ;
- ;******************************************************************************
- ;
- ; BSStoreMPIInfo - Information about the Store that the Mapping Plug-in can
- ; provide
- ;
- ; *****************************************************************************
- ;
- BSStoreMPIInfo RECORD 0
- curState ds.l 1 ; offset: $0 (0)
- storeSize ds BSByteCount ; offset: $4 (4)
- readBlockSize ds BSByteCount ; offset: $C (12) ; minimum read size & granularity
- writeBlockSize ds BSByteCount ; offset: $14 (20) ; minimum write size & granularity
- isEjectable ds.b 1 ; offset: $1C (28)
- isWriteable ds.b 1 ; offset: $1D (29)
- hasAutoEjectHardware ds.b 1 ; offset: $1E (30)
- isFormattable ds.b 1 ; offset: $1F (31)
- isPartitionable ds.b 1 ; offset: $20 (32)
- isFilesystem ds.b 1 ; offset: $21 (33)
- reserved1 ds.b 1 ; offset: $22 (34)
- reserved2 ds.b 1 ; offset: $23 (35)
- curFormat ds BSStoreFormatInfo ; offset: $24 (36)
- possibleFormats ds.b 8 * BSStoreFormatInfo.sizeof ; offset: $34 (52)
- name ds.b 48 ; offset: $B4 (180)
- sizeof EQU * ; size: $E4 (228)
- ENDR
- ; typedef struct BSStoreMPIInfo * BSStoreMPIInfoPtr
-
- ;
- ;******************************************************************************
- ;
- ; BSStorePPIInfo - Information about the Store that the Partitioning Plug-in
- ; can provide
- ;
- ; *****************************************************************************
- ;
- BSStorePPIInfo RECORD 0
- numPartitions ds.l 1 ; offset: $0 (0)
- maxPartitions ds.l 1 ; offset: $4 (4)
- sizeof EQU * ; size: $8 (8)
- ENDR
- ; typedef struct BSStorePPIInfo * BSStorePPIInfoPtr
-
- ;
- ;******************************************************************************
- ;
- ; BSContainerPIInfo - Information about the Container that the Container
- ; Plug-in can provide
- ;
- ; *****************************************************************************
- ;
- BSContainerPIInfo RECORD 0
- numChildren ds.l 1 ; offset: $0 (0)
- isEjectable ds.b 1 ; offset: $4 (4)
- ORG 6
- sizeof EQU * ; size: $6 (6)
- ENDR
- ; typedef struct BSContainerPIInfo * BSContainerPIInfoPtr
-
- ;
- ;******************************************************************************
- ; *******************************************************************************
- ; *******************************************************************************
- ;
- ; Plug-In Interface Functions
- ;
- ; *******************************************************************************
- ; *******************************************************************************
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; *******************************************************************************
- ;
- ; Mapping Plug-In Interface
- ;
- ; *******************************************************************************
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSMappingPIExamine - Plug-in's opportunity to examine a device and determine
- ; if it is an appropriate plug-in for it
- ;
- ; Inputs: examineStore - a pointer to the in-process Store to be examined
- ;
- ; Outputs: confidence - level of confidence the plug-in has that the plugin
- ; is the correct one
- ;
- ; Returns: E_BSSuccess if no errors happened examining the device.
- ; If an error happened, the error received from the other family is
- ; returned
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSMappingPIInit - Plug-in's initialization routine. Called when plug-in
- ; is selected for a Store. Plug-in's opportunity to initialize
- ; device, allocate data structures, etc.
- ;
- ; Inputs: initStore - a pointer to the Store this plug-in will be attached
- ; to
- ; Outputs: curState - the current state of the media
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSMappingPICleanup - Plug-in's dispose routine. Called when Store is
- ; being disposed of. Should dispose of any memory or data structures
- ; held for this Store, finalize all I/O for Store
- ;
- ; Inputs: cleanupStore - Store that is being disposed of
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSMappingPIIO - Plug-in's input/output routine
- ;
- ; Inputs: ioStore - the Store on which IO is to be performed
- ; blocks - descriptor of the blocks to do IO on
- ; memory - descriptor of the memory to do IO on (memory has been prepared)
- ; parentRequest - the request this request is being made on behalf of
- ; options - read/write
- ;
- ; Outputs: errors - where exactly the errors occured, if any
- ;
- ; Returns: kBSIOContinuing if IO was started successfully and the I/O
- ; completion routine still needs to be called
- ; kBSIOCompleted if IO was completed and no further action is
- ; necessary
- ; kBSIOFailed if IO failed for some reason
- ; kBSIONotStarted if the IO could not be started
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSMappingPIFlush - flush plug-in's cached data (if any)
- ; BSMappingPIFlush flushes the plug-in's cached data. It is called
- ; in a similar fashion to an I/O request. BSStoreRW may be used
- ; as may BSStoreFlush.
- ;
- ; Inputs: flushStore - the Store on which flush is to be performed
- ; parentRequest - the request this request is being made on behalf of
- ;
- ; Outputs: errors - where exactly the errors occured, if any
- ;
- ; Returns: kBSIOContinuing if IO was started successfully and the I/O
- ; completion routine still needs to be called
- ; kBSIOCompleted if IO was completed and no further action is
- ; necessary
- ; kBSIOFailed if IO failed for some reason
- ; kBSIONotStarted if the IO could not be started
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSMappingPIAddComponent - Notifies Plug-in about new components to be added
- ; to it
- ;
- ; Inputs: destStore - the Store the blocks are to be mapped into
- ; newComponent - the new Component to be mapped in
- ;
- ; Outputs: storeNewInfo - the new information about the Store
- ;
- ;
- ; Returns: E_BSSuccess if successful
- ; E_BSMPITooManyMappings if no more mappings can be handled
- ; E_BSMPIOutOfStoreBounds if the start of the destination blocks
- ; would cause a gap in the Store
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSMappingPIGoToState - Requests plug-in to take Store to the specified
- ; accessibility state.
- ;
- ; Inputs: theStore - Store to take to the state
- ; gotoState - what state to go to (possible states defined above)
- ;
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSMappingPIFormatMedia - tells plug-in to do a low-level format of the media
- ;
- ; Inputs: formatStore - Store to format
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccessful if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSMappingPIGetInfo - gets information about the device and the plug-in
- ;
- ; Inputs: formatStore - Store to format
- ;
- ; Outputs: info - the filled in information
- ;
- ; Returns: E_BSSuccessful if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSMappingIOCompletion - I/O completion routine for a mapping plug-in
- ;
- ; Inputs: theStore: - A pointer to the Store in question
- ; finishedPrivateData - A pointer to the private data the Mapping
- ; plug-in associated with this I/O
- ; returnedBSErrorList - A pointer to a BSErrorList if the
- ; triggering event came from another BS plug-in
- ; returnedStatus - The OSStatus returned by the other family or
- ; plug-in that was called
- ; Outputs: errorListPtrPtr - A pointer to a pointer to a BSErrorList.
- ; The BSErrorList is allocated and filled in by the completion
- ; routine if the I/O has failed. It should be allocated using
- ; BSErrorListAllocate and will be deallocated by the family code.
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- BlockStoragePlugInInfo RECORD 0
- version ds.l 1 ; offset: $0 (0)
- reserved1 ds.l 1 ; offset: $4 (4)
- reserved2 ds.l 1 ; offset: $8 (8)
- reserved3 ds.l 1 ; offset: $C (12)
- sizeof EQU * ; size: $10 (16)
- ENDR
- BSStoreMappingOps RECORD 0
- header ds BlockStoragePlugInInfo ; offset: $0 (0)
- DeviceExamine ds.l 1 ; offset: $10 (16)
- Init ds.l 1 ; offset: $14 (20)
- Cleanup ds.l 1 ; offset: $18 (24)
- IO ds.l 1 ; offset: $1C (28)
- Flush ds.l 1 ; offset: $20 (32)
- AddComponent ds.l 1 ; offset: $24 (36)
- GotoState ds.l 1 ; offset: $28 (40)
- Format ds.l 1 ; offset: $2C (44)
- GetInfo ds.l 1 ; offset: $30 (48)
- ioCompletion ds.l 1 ; offset: $34 (52)
- sizeof EQU * ; size: $38 (56)
- ENDR
- ; typedef struct BSStoreMappingOps * BSStoreMappingOpsPtr
-
- ;
- ;******************************************************************************
- ;
- ; BSMPIBackgroundTask - a background task entry point for a Mapping plug-in.
- ; BSMPIStartBackgroundTask may be used by the Mapping plug-in to
- ; start one of these. The task will be automatically terminated
- ; after the Cleanup routine is executed
- ;
- ; Inputs: theStore - the Store this is running for
- ; theArg - the argument passed to BSMPIStartBackgroundTask
- ;
- ; Outputs: <none>
- ;
- ; Returns: Errors are ignored but will be logged.
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; *******************************************************************************
- ;
- ; Partitioning Plug-In Interface
- ;
- ; *******************************************************************************
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSPartitioningPIExamine - Plug-in's opportunity to examine a Store and
- ; determine if it's the right plug-in for it
- ;
- ; Inputs: readStoreConn - a connection to the Store to be examined
- ;
- ; Outputs: certainty - 0 if the plug-in did not recognize the partition
- ; map format
- ; otherwise the number of bytes read
- ;
- ; Returns: E_BSSuccess if no errors occured
- ; E_BSPPIOutOfResources if memory or other resource couldn't
- ; be allocated
- ; otherwise the Block Storage error from the I/O
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSPartitioningPIInit - Plug-in's initialization routine. Called when
- ; plug-in is selected for a Store. Plug-in's opportunity to
- ; initialize device, allocate data structures, etc.
- ;
- ; Inputs: initStore - pointer to the Store the plug-in is being attached to
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSPartitioningPICleanup - Plug-in's dispose routine. Called when Store is
- ; being disposed of. Should dispose of any memory or data structures
- ; held for this Store and flush the partition map if necessary
- ;
- ; Inputs: cleanupStore - Store that is being disposed of
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSPartitioningPIInitializeMap - lays down a new partition map on a Store (plug-in has
- ; already been attached)
- ;
- ; Inputs: initStore - the Store to be initialized
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ; otherwise, Block Storage error if I/O fails
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSPartitioningPIGetInfo - Gets information about the partition map and the
- ; partitioning plug-in
- ;
- ; Inputs: store - the Store to read from
- ;
- ; Outputs: info - the filled in information
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSPartitioningPIGetEntry - Get a particular partition map entry
- ;
- ; Inputs: readStore - the Store
- ; entryNum - which entry to read
- ;
- ; Outputs: retEntry - pointer to a BSPartitionDescriptor that's filled in
- ; with the entry
- ;
- ; Returns: E_BSSuccess if successful
- ; E_BSPPIPartitionNonExistant if that entry does not exist
- ; other Block Storage error if I/O problem
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSPartitioningSetEntry - Sets the information in a particular partition map
- ; entry
- ;
- ; Inputs:
- ;
- ; Outputs:
- ;
- ; Returns:
- ;
- ; *****************************************************************************
- ;
- BSStorePartitioningOps RECORD 0
- header ds BlockStoragePlugInInfo ; offset: $0 (0)
- Examine ds.l 1 ; offset: $10 (16)
- Init ds.l 1 ; offset: $14 (20)
- Cleanup ds.l 1 ; offset: $18 (24)
- InitializeMap ds.l 1 ; offset: $1C (28)
- GetInfo ds.l 1 ; offset: $20 (32)
- GetEntry ds.l 1 ; offset: $24 (36)
- SetEntry ds.l 1 ; offset: $28 (40)
- sizeof EQU * ; size: $2C (44)
- ENDR
- ; typedef struct BSStorePartitioningOps * BSStorePartitioningOpsPtr
-
- ;
- ;******************************************************************************
- ; *******************************************************************************
- ;
- ; Container Plug-In Interface
- ;
- ; *******************************************************************************
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSContainerPIExamine - Called to allow the Container plug-in to verify
- ; that it is correct for the Container
- ;
- ; Inputs: initContainer - the Container in question
- ;
- ; Outputs: levelOfConfidence - how confident the plug-in is that it is the
- ; correct one
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSContainerPIInit - Plug-in's initialization routine. Called when
- ; plug-in is selected for a Container. Plug-in's opportunity to
- ; initialize device, allocate data structures, etc.
- ;
- ; Inputs: initContainer - a pointer to the Container this plug-in will
- ; be attached to
- ; Outputs: info - information about the new Container
- ; backgroundTask - if true, the BackgroundTask entry point will
- ; be invoked in its own private task.
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSContainerPICleanup - cleans up plug-in state
- ;
- ; Inputs: container - the Container to clean up for
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSContainerPIGoToState - Tells the Container to go the specified state
- ;
- ; Inputs: container - the Container to take to the state
- ; accessState - the state to go to
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSContainerPIAddContainer - Informs the Container of a new sub-Container
- ; being added
- ;
- ; Inputs: destContainer - the Container we're adding to
- ; addedContainer - the Container being added
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSContainerPIGetInfo - Gets information about a Container
- ;
- ; Inputs: infoContainer - the Container to get information about
- ;
- ; Outputs: info - the filled in information buffer
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ;
- ; BSContainerPIBackgroundTask - an optional entry point that will be executed
- ; within its own task context if the backgroundTask flag is set on exit
- ; from the Container Plug-in's init routine
- ;
- ; Inputs: container - the Container the Background Task is being invoked
- ; on behalf of
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccessful if successful
- ;
- ; *****************************************************************************
- ;
- BSContainerPolicyOps RECORD 0
- header ds BlockStoragePlugInInfo ; offset: $0 (0)
- Examine ds.l 1 ; offset: $10 (16)
- Init ds.l 1 ; offset: $14 (20)
- Cleanup ds.l 1 ; offset: $18 (24)
- GoToState ds.l 1 ; offset: $1C (28)
- AddContainer ds.l 1 ; offset: $20 (32)
- GetInfo ds.l 1 ; offset: $24 (36)
- BackgroundTask ds.l 1 ; offset: $28 (40)
- sizeof EQU * ; size: $2C (44)
- ENDR
- ; typedef struct BSContainerPolicyOps * BSContainerPolicyOpsPtr
-
- ;
- ;******************************************************************************
- ;
- ; BSCPIBackgroundTask - a background task entry point for a Container plug-in.
- ; BSCPIStartBackgroundTask may be used by the Container plug-in to
- ; start one of these. The task will be automatically terminated
- ; after the Cleanup routine is executed
- ;
- ; Inputs: theContainer - the Container this is running for
- ; theArg - the argument passed to BSMPIStartBackgroundTask
- ;
- ; Outputs: <none>
- ;
- ; Returns: Errors are ignored but will be logged.
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; *******************************************************************************
- ; *******************************************************************************
- ;
- ; Block Storage Family Services
- ;
- ; *******************************************************************************
- ; *******************************************************************************
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSStoreRW - Request I/O from another Store. Used by Mapping Plug-ins.
- ; Not for use by Partitioning Plug-ins!!
- ;
- ; Inputs: rwStore - the Store to do I/O with
- ; blocks - the blocks for the transfer
- ; memory - the memory for the transfer
- ; parentRequest - the BSIORequestPtr that the requestor was called
- ; with
- ; privateData - pointer to be given to the completion routine
- ; when it is called
- ; options - read/write
- ;
- ; Outputs: errors - where errors occurred, if any occurred
- ;
- ; Returns: return code from other plug-in
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern BSIOStatus BSStoreRW(BSStorePtr rwStore, BSBlockListDescriptorRef blocks, MemListDescriptorRef memory, BSIORequestBlockPtr parentRequest, void *privateData, OptionBits options, BSErrorListPtr *errors)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreRW
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSStoreFlush - Request another Store to flush its caches. Used by Mapping Plug-ins.
- ; Not for use by Partitioning Plug-ins!!
- ;
- ; Inputs: flushStore - the Store to flush
- ; parentRequest - the BSIORequestPtr that the requestor was called
- ; with
- ; privateData - pointer to be given to the completion routine
- ; when it is called
- ;
- ; Outputs: errors - where errors occurred, if any occurred
- ;
- ; Returns: return code from other plug-in
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern BSIOStatus BSStoreFlush(BSStorePtr flushStore, BSIORequestBlockPtr parentRequest, void *privateData, BSErrorListPtr *errors)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreFlush
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSTrackOtherFamilyRequest - informs the Block Storage family code what routine
- ; should be called when the other I/O family the request is being passed to
- ; notifies the Block Storage family of its completion. The Mapping plug-in's
- ; ioCompletion routine will be called when the notification of the request
- ; completion is received.
- ;
- ; Inputs: ioStore - Store I/O is taking place in
- ; curRequest - BSIORequestBlock for which this I/O is taking place.
- ; This was the BSIORequestBlockPtr passed into the R/W
- ; routine.
- ; privateData - Private data to be passed back when the completion routine
- ; is called.
- ; retNotify - Pointer to a kernel notification structure that will
- ; be filled in by BSTrackOtherFamilyRequest to be given
- ; to the other family in the async API call
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if able to track request
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSTrackOtherFamilyRequest(BSStorePtr ioStore, BSIORequestBlockPtr curRequest, void *privateData, KernelNotificationPtr retNotify)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSTrackOtherFamilyRequest
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSMPIStartBackgroundTask - starts a background task for a Mapping Plug-in.
- ; The task will be terminated after the Cleanup routines for the Plug-in
- ; is called for this Store.
- ;
- ; Inputs: store - the Store the background task is being started for
- ; backgroundTask - the function to start
- ; arg - the argument to be passed to the function
- ;
- ; Outputs: taskID - the task ID of the new task
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSMPIStartBackgroundTask(BSStorePtr store, BSMPIBackgroundTask backgroundTask, void *arg, TaskID *taskID)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSMPIStartBackgroundTask
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSCPIStartBackgroundTask - starts a background task for a Container Plug-in.
- ; The task will be terminated after the Cleanup routines for the Plug-in
- ; is called for this Container.
- ;
- ; Inputs: container - the Container the background task is being started for
- ; backgroundTask - the function to start
- ; arg - the argument to be passed to the function
- ;
- ; Outputs: taskID - the task ID of the new task
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSCPIStartBackgroundTask(BSContainerPtr container, BSCPIBackgroundTask backgroundTask, void *arg, TaskID *taskID)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSCPIStartBackgroundTask
- ENDIF
-
- ;
- ;******************************************************************************
- ; *******************************************************************************
- ;
- ; Store Accessor functions
- ;
- ; *******************************************************************************
- ; *****************************************************************************
- ;
- ;
- ;******************************************************************************
- ; BSGetMappingPIPrivateData - retrieves the Mapping Plug-in's private data
- ; from a Store
- ;
- ; Inputs: accessStore - the Store to retrieve the data from
- ;
- ; Outputs: <none>
- ;
- ; Returns: pointer to data
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern void *BSGetMappingPIPrivateData(BSStorePtr accessStore)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSGetMappingPIPrivateData
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSSetMappingPIPrivateData - sets the Mapping Plug-in's private data
- ; for a Store
- ;
- ; Inputs: accessStore - the Store to set the data in
- ; privateData - pointer to the data
- ;
- ; Outputs: <none>
- ;
- ; Returns: <none>
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern void BSSetMappingPIPrivateData(BSStorePtr accessStore, void *privateData)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSSetMappingPIPrivateData
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSGetPartitioningPIPrivateData - retrieves the Partitioning Plug-in's private
- ; data from a Store
- ;
- ; Inputs: accessStore - the Store to retrieve the data from
- ;
- ; Outputs: <none>
- ;
- ; Returns: pointer to data
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern void *BSGetPartitioningPIPrivateData(BSStorePtr accessStore)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSGetPartitioningPIPrivateData
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSSetPartitioningPIPrivateData - sets the Partitioning Plug-in's private data
- ; for a Store
- ;
- ; Inputs: accessStore - the Store to set the data in
- ; privateData - pointer to the data
- ;
- ; Outputs: <none>
- ;
- ; Returns: <none>
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern void BSSetPartitioningPIPrivateData(BSStorePtr accessStore, void *privateData)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSSetPartitioningPIPrivateData
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSStoreGetNumComponents - Gets the number of component Stores or Devices
- ; that have been put together into this Store
- ;
- ; Inputs: accessStore - the Store to get the number of components from
- ;
- ; Outputs: <none>
- ;
- ; Returns: number of components
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern ItemCount BSStoreGetNumComponents(BSStorePtr accessStore)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreGetNumComponents
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSStoreGetComponents - Gets the information about a particular component
- ; of a Store
- ;
- ; Inputs: accessStore - the Store to get the number of components from
- ; componentNum - which component to return
- ;
- ; Outputs: component - the BSStoreComponent buffer that is filled in
- ;
- ; Returns: E_BSSuccess if no problems
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSStoreGetComponent(BSStorePtr accessStore, ItemCount componentNum, BSStoreMPIComponentPtr component)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreGetComponent
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSStoreSetNumPartitions - sets the number of partitions in the Store
- ;
- ; Inputs: accessStore - the Store to get the number of components from
- ; numPartitions - the new partition count
- ;
- ; Outputs: <none>
- ;
- ; Returns: <none>
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern void BSStoreSetNumPartitions(BSStorePtr accessStore, ItemCount numPartitions)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreSetNumPartitions
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSStoreGetPPIConnection - Gets the Store connection for the partitioning
- ; plug-ins
- ;
- ; Inputs: accessStore - the Store to get connection from
- ;
- ; Outputs: <none>
- ;
- ; Returns: Connection to the Store (kInvalidID if none)
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern BSStoreConnID BSStoreGetPPIConnection(BSStorePtr accessStore)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreGetPPIConnection
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSStoreGetAccessibilityState - Gets the current accessibility state of the Store
- ;
- ; Inputs: accessStore - the Store to get connection from
- ;
- ; Outputs: <none>
- ;
- ; Returns: Store's state
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern BSAccessibilityState BSStoreGetAccessibilityState(BSStorePtr accessStore)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreGetAccessibilityState
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSStoreSetAccessibilityState - Sets the current accessibility state of the Store
- ;
- ; Inputs: accessStore - the Store to get connection from
- ; setState - the state to set the Store to
- ;
- ; Outputs: <none>
- ;
- ; Returns: <none>
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern void BSStoreSetAccessibilityState(BSStorePtr accessStore, BSAccessibilityState setState)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreSetAccessibilityState
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSStoreGetMPIInfo - Calls the GetInfo routine of the Mapping plug-in
- ; attached to the Store
- ;
- ; Inputs: accessStore - the Store to get connection from
- ; info - a pointer to the buffer to put the returned info into
- ;
- ; Outputs: <none>
- ;
- ; Returns: <none>
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSStoreGetMPIInfo(BSStorePtr accessStore, BSStoreMPIInfo *info)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreGetMPIInfo
- ENDIF
-
- ;
- ;******************************************************************************
- ; BSStoreGetPPIInfo - Calls the GetInfo routine of the Partitioning plug-in
- ; attached to the Store
- ;
- ; Inputs: accessStore - the Store to get connection from
- ; info - a pointer to the buffer to put the returned info into
- ;
- ; Outputs: <none>
- ;
- ; Returns: <none>
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSStoreGetPPIInfo(BSStorePtr accessStore, BSStorePPIInfo *info)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSStoreGetPPIInfo
- ENDIF
-
- ;
- ;******************************************************************************
- ;
- ; BSMPINotifyFamilyStoreChangedState - called from a Mapping Plug-in (typically
- ; in the BackgroundTask) to inform the Block Storage Family of an
- ; unexpected accessibility change, e.g. the media was removed or the disk
- ; spun down.
- ;
- ; Inputs: changedStore - the Store that changed
- ; newState - the state the Store is now in
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSMPINotifyFamilyStoreChangedState(BSStorePtr changedStore, BSAccessibilityState newState)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSMPINotifyFamilyStoreChangedState
- ENDIF
-
- ;
- ;******************************************************************************
- ;
- ; BSMPIRequestStoreStateChange - requests a state change of the Store. This
- ; should be used, for example, if a device has an eject button that can
- ; be monitored by the Mapping Plug-in. If the eject button is pressed
- ; BSMPIRequestStoreStateChange should be used to notify the Family that
- ; an eject has been requested and the Family can then notify clients and
- ; flush data to the media properly. This call waits until permission is
- ; granted or denied by the Expert. The GoToState call of the plug-in
- ; will be invoked before this calls returns if permission is granted.
- ;
- ; Inputs: changeStore - the Store the state change will affect
- ; requestedState - the state the Store is being requested to go to
- ;
- ; Outputs: permission - true if permission was granted and the Store
- ; successfully went to the State requested.
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSMPIRequestStoreStateChange(BSStorePtr changeStore, BSAccessibilityState requestedState, Boolean *permission)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSMPIRequestStoreStateChange
- ENDIF
-
- ;
- ;******************************************************************************
- ;
- ; BSCPINotifyFamilyContainerChangedState - called from a Container Plug-in
- ; (typically in the BackgroundTask) to inform the Block Storage Family of
- ; an unexpected accessibility change, e.g. the media was removed.
- ;
- ; Inputs: changedStore - the Store that changed
- ; newState - the state the Store is now in
- ;
- ; Outputs: <none>
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSCPINotifyFamilyContainerChangedState(BSContainerPtr changedContainer, BSAccessibilityState newState)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSCPINotifyFamilyContainerChangedState
- ENDIF
-
- ;
- ;******************************************************************************
- ;
- ; BSCPIRequestContainerStateChange - requests a state change of the Container.
- ; This should be used, for example, if a device has an eject button that
- ; can be monitored by the Container Plug-in. If the eject button is pressed
- ; BSCPIRequestStoreStateChange should be used to notify the Family that
- ; an eject has been requested and the Family can then notify clients and
- ; flush data to the media properly. This call waits until permission is
- ; granted or denied by the Expert. The GoToState call of the plug-in
- ; will be invoked before this calls returns if permission is granted.
- ;
- ; Inputs: changeContainer - the Container the state change will affect
- ; requestedState - the state the Container is being requested to go to
- ;
- ; Outputs: permission - true if permission was granted and the Container
- ; successfully went to the State requested.
- ;
- ; Returns: E_BSSuccess if successful
- ;
- ; *****************************************************************************
- ;
- ;
- ; extern OSStatus BSCPIRequestContainerStateChange(BSStorePtr changeContainer, BSAccessibilityState requestedState, Boolean *permission)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION BSCPIRequestContainerStateChange
- ENDIF
-
- ENDIF
- ENDIF ; __BLOCKSTORAGEPLUGIN__
-
-